# frozen_string_literal: true

module VulnerabilityScopes
  extend ActiveSupport::Concern

  included do
    scope :without_archived_projects, -> { joins(:project).merge(::Project.non_archived) }
    scope :for_projects, ->(project_ids, include_archived = false) do
      if include_archived
        where(project_id: project_ids)
      else
        without_archived_projects.where(project_id: project_ids)
      end
    end
  end
end
